IndexedDB: Add initial implementation of EventCacheStore#5343
Merged
Hywan merged 11 commits intomatrix-org:mainfrom Jul 9, 2025
Merged
Conversation
EventCacheStore
Hywan
approved these changes
Jul 7, 2025
Member
Hywan
left a comment
There was a problem hiding this comment.
Awesome. Just awesome. Well done!
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #5343 +/- ##
==========================================
- Coverage 88.77% 88.76% -0.01%
==========================================
Files 334 334
Lines 91086 91086
Branches 91086 91086
==========================================
- Hits 80860 80851 -9
- Misses 6387 6396 +9
Partials 3839 3839 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…odule Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
7752d32 to
f4cc0c7
Compare
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…ry store) Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…d_chunk_updates Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…e_linked_chunk_updates Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
…all_chunks Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
f4cc0c7 to
a1f34a9
Compare
Contributor
Author
|
Oops! Forgot to autosquash when rebasing, so did it a second time! |
This was referenced Jul 9, 2025
Merged
This was referenced Aug 6, 2025
1 task
1 task
1 task
This was referenced Sep 16, 2025
1 task
Merged
1 task
This was referenced Dec 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
This pull request is part of a series of pull requests to add a full IndexedDB implementation of the
EventCacheStore(see #4617, #4996, #5090, #5138, #5226, #5274). This particular pull request focuses on providing implementations of a fewEventCacheStorefunctions.Changes
The primary change is the addition of a top-level type,
IndexeddbEventCacheStore, as well as a way of constructing this type throughIndexeddbEventCacheStoreBuilder. Additionally,IndexeddbEventCacheStorealso provides an implementation ofEventCacheStore.In order to limit the size of this pull request, the implementation of
EventCacheStoreis almost entirely delegated to a nestedMemoryStoreexcept for the following two functions, which have a genuine IndexedDB implementation.EventCacheStore::handle_linked_chunk_updatesEventCacheStore::load_all_chunksAdditionally, there are a number of additions to
IndexeddbEventCacheStoreTransactionwhich support the implementation of theEventCacheStorefunctions above.get_chunk_by_idget_chunks_in_roomload_chunk_by_idadd_chunkdelete_chunk_by_iddelete_chunks_in_roomget_events_by_positionget_events_by_chunkput_eventdelete_events_by_positiondelete_event_by_positiondelete_events_by_chunkdelete_events_by_chunk_from_indexdelete_events_in_roomget_gap_by_iddelete_gap_by_iddelete_gaps_in_roomThese are mostly typed wrappers around the generic functions in
IndexeddbEventCacheStoreTransaction, though some of them add extra functionality as well.Tests
A quick note about the tests. Because most of the functions are delegated to a nested
MemoryStoreand only two are actually implemented, theevent_cache_store_integration_testsmacro will generate many failures. Consequently, I have made a local copy of the macro which only includes tests which are relevant toEventCacheStore::handle_linked_chunk_updatesandEventCacheStore::load_all_chunks. Once all functionality is added, this local macro will disappear and I will use the original one frommatrix_sdk_base.Additionally, there are a number of tests which have been copied and adapted from SQLite implementation of
EventCacheStore. Many of these tests will likely be generalized and included as part of theevent_cache_store_integration_testsmacro and will also, hopefully, disappear (see #5342).Future Work
EventCacheStorefunctions without relying onMemoryStore.Signed-off-by: Michael Goldenberg m@mgoldenberg.net